extreme_values <- function(inpath, outpath, para, limits, digit) {

  extremes <- sapply(seq(inpath), function(i){

    funct = c("min", "max")
    df <- read.table(inpath[i], header = T, sep = ",", fill = T,
                     stringsAsFactors = F)

    start_time <- df$Datetime[1]
    end_time <- df$Datetime[nrow(df)]
    start_time <- strptime(start_time, format = "%Y-%m-%d %H:%M:%S")
    end_time <- strptime(end_time, format = "%Y-%m-%d %H:%M:%S")
    value <- 1
    by <- paste(as.character(value), "day", sep=" ")
    tseries <- seq(from = as.POSIXct(start_time), to = as.POSIXct(end_time) , by = by)
    tseries <- format(tseries, usetz=F)
    tseries <- rep(tseries, each = nrow(df)/length(tseries))
    lapply(seq(funct), function(j){
      print(j)
      df_out <- aggregate(df, by = list(tseries), FUN = funct[j], na.rm=T)
      df_out <- df_out[,-1]
      names(df_out) <- c(names(df))
      return(df_out)
      }
    )
  }
    )
  print(str(extremes))
}

extreme_values (
    inpath = c("be_000HEG05_00CEMU_201001010000_201001312330_mez_ca05_cti30_0005.dat", 
               "be_000HEG05_00CEMU_201002010000_201002282330_mez_ca05_cti30_0005.dat"),
    outpath = "extreme_values_out.txt",
    para = "Ta_200",
    limits = c(0.01),
    digit = c(3))